<div class="breadcrumbs breadcrumbs-fixed ace-save-state">
    <ul class="breadcrumb">
        <li>
            <i class="ace-icon fa fa-users home-icon"></i>
            <a href="#">种植管理</a>
        </li>
        <li class="active">植友果树交易列表</li>
    </ul>
</div>


<div class="page-content">
    <div class="row">
        <div class="col-xs-12">
            <h4 class="header smaller lighter blue">植友果树交易列表</h4>
            <div class="row">
                <div class="col-sm-3">
                </div>
                <div class="col-sm-9">
                    <form id="searchForm" class="form-inline text-right" role="search">
                        <div class="input-group">
                            <input id="nameOrMobile" name="nameOrMobile" class="form-control input-sm" type="text"
                                   placeholder="用户名称"/>
                            <span class="input-group-btn">
                                <button id="searchBtn" class="btn btn-xs btn-info" type="button">
                                    <i class="ace-icon fa fa-search"></i> 搜索
                                </button>
					        </span>
                        </div>
                    </form>
                </div>
            </div>
            <div class="space-6"></div>
            <div class="dataTables_wrapper form-inline no-footer">
                <table id="company-table" class="table table-striped table-bordered table-hover">
                    <thead>
                    <tr>
                        <th>序号</th>
                        <th>用户名称</th>
                        <th>果树编号</th>
                        <th>种植时长</th>
                        <th>挂单时间</th>
                        <th>定价</th>
                        <th>状态</th>
                    </tr>
                    </thead>
                </table>
            </div>
        </div>
    </div>

    <script type="text/javascript">
        $(function () {
            company_table = $('#company-table').DataTable({
                language: {url: 'ace/json/dataTable_CN.json'},
                autoWidth: false,
                ordering: false,
                searching: false,
                serverSide: true,
                processing: true,
                deferRender: true,
                responsive: true,
                ajax: {
                    url: 'management/treeMarketList'
                },
                columns: [
                    {
                        data: 'id',
                        defaultContent: ''
                    }, {
                        data: 'name',
                        defaultContent: ''
                    },
                    {
                        data: 'goodsId',
                        defaultContent: ''
                    }, {
                        data: 'days',
                        defaultContent: ''
                    }, {
                        data: 'createTime',
                        defaultContent: ''
                    }, {
                        data: 'recyclePrice',
                        defaultContent: ''
                    }, {
                        data: function (row) {
                            if (row.status === 4) {
                                return ' 挂单'
                            }
                            if (row.status === 3) {
                                return ' 已完成'
                            }
                        }
                    }
                ]
            });

            $('#searchBtn').click(function () {
                var param = $("#searchForm").serialize();
                company_table.ajax.url("management/treeMarketList?" + param).load();
            });

            $('#company-table').find('> thead > tr > th input[type=checkbox]').eq(0).on('click', function () {
                $('#company-table').find('tbody > tr').find('input:checkbox').prop("checked", this.checked);
            });

        });
    </script>
</div>